<!-- HTML header for doxygen 1.8.6-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/xhtml;charset=utf-8" http-equiv="Content-Type"/>
<meta content="IE=9" http-equiv="X-UA-Compatible"/>
<meta content="Doxygen 1.8.13" name="generator"/>
<title>OpenCV: Motion Analysis and Object Tracking</title>
<link href="../../opencv.ico" rel="shortcut icon" type="image/x-icon"/>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script src="../../jquery.js" type="text/javascript"></script>
<script src="../../dynsections.js" type="text/javascript"></script>
<script src="../../tutorial-utils.js" type="text/javascript"></script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script src="../../search/searchdata.js" type="text/javascript"></script>
<script src="../../search/search.js" type="text/javascript"></script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
//<![CDATA[
MathJax.Hub.Config(
{
  TeX: {
      Macros: {
          matTT: [ "\\[ \\left|\\begin{array}{ccc} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \\end{array}\\right| \\]", 9],
          fork: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ \\end{array} \\right.", 4],
          forkthree: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ #5 & \\mbox{#6}\\\\ \\end{array} \\right.", 6],
          forkfour: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ #5 & \\mbox{#6}\\\\ #7 & \\mbox{#8}\\\\ \\end{array} \\right.", 8],
          vecthree: ["\\begin{bmatrix} #1\\\\ #2\\\\ #3 \\end{bmatrix}", 3],
          vecthreethree: ["\\begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \\end{bmatrix}", 9],
          cameramatrix: ["#1 = \\begin{bmatrix} f_x & 0 & c_x\\\\ 0 & f_y & c_y\\\\ 0 & 0 & 1 \\end{bmatrix}", 1],
          distcoeffs: ["(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6 [, s_1, s_2, s_3, s_4[, \\tau_x, \\tau_y]]]]) \\text{ of 4, 5, 8, 12 or 14 elements}"],
          distcoeffsfisheye: ["(k_1, k_2, k_3, k_4)"],
          hdotsfor: ["\\dots", 1],
          mathbbm: ["\\mathbb{#1}", 1],
          bordermatrix: ["\\matrix{#1}", 1]
      }
  }
}
);
//]]>
</script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js" type="text/javascript"></script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css"/>
<link href="../../stylesheet.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<!--#include virtual="/google-search.html"-->
<table cellpadding="0" cellspacing="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="../../opencv-logo-small.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">OpenCV
    <span id="projectnumber">4.5.2</span>
   </div>
   <div id="projectbrief">Open Source Computer Vision</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
</script>
<script src="../../menudata.js" type="text/javascript"></script>
<script src="../../menu.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
  initMenu('../../',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow" onkeydown="return searchBox.OnSearchSelectKey(event)" onmouseout="return searchBox.OnSearchSelectHide()" onmouseover="return searchBox.OnSearchSelectShow()">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe frameborder="0" id="MSearchResults" name="MSearchResults" src="javascript:void(0)">
</iframe>
</div>
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Motion Analysis and Object Tracking<div class="ingroups"><a class="el" href="../../d7/dbd/group__imgproc.html">Image Processing</a></div></div>  </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga1a567a79901513811ff3b9976923b199"><td align="right" class="memItemLeft" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/df3/group__imgproc__motion.html#ga1a567a79901513811ff3b9976923b199">cv::accumulate</a> (<a class="el" href="../../dc/d84/group__core__basic.html#ga353a9de602fe76c709e12074a6f362ba">InputArray</a> src, <a class="el" href="../../dc/d84/group__core__basic.html#gaf77c9a14ef956c50c1efd4547f444e63">InputOutputArray</a> dst, <a class="el" href="../../dc/d84/group__core__basic.html#ga353a9de602fe76c709e12074a6f362ba">InputArray</a> mask=<a class="el" href="../../dc/d84/group__core__basic.html#gad9287b23bba2fed753b36ef561ae7346">noArray</a>())</td></tr>
<tr class="memdesc:ga1a567a79901513811ff3b9976923b199"><td class="mdescLeft"> </td><td class="mdescRight">Adds an image to the accumulator image.  <a href="../../d7/df3/group__imgproc__motion.html#ga1a567a79901513811ff3b9976923b199">More...</a><br/></td></tr>
<tr class="separator:ga1a567a79901513811ff3b9976923b199"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga82518a940ecfda49460f66117ac82520"><td align="right" class="memItemLeft" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/df3/group__imgproc__motion.html#ga82518a940ecfda49460f66117ac82520">cv::accumulateProduct</a> (<a class="el" href="../../dc/d84/group__core__basic.html#ga353a9de602fe76c709e12074a6f362ba">InputArray</a> src1, <a class="el" href="../../dc/d84/group__core__basic.html#ga353a9de602fe76c709e12074a6f362ba">InputArray</a> src2, <a class="el" href="../../dc/d84/group__core__basic.html#gaf77c9a14ef956c50c1efd4547f444e63">InputOutputArray</a> dst, <a class="el" href="../../dc/d84/group__core__basic.html#ga353a9de602fe76c709e12074a6f362ba">InputArray</a> mask=<a class="el" href="../../dc/d84/group__core__basic.html#gad9287b23bba2fed753b36ef561ae7346">noArray</a>())</td></tr>
<tr class="memdesc:ga82518a940ecfda49460f66117ac82520"><td class="mdescLeft"> </td><td class="mdescRight">Adds the per-element product of two input images to the accumulator image.  <a href="../../d7/df3/group__imgproc__motion.html#ga82518a940ecfda49460f66117ac82520">More...</a><br/></td></tr>
<tr class="separator:ga82518a940ecfda49460f66117ac82520"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gacb75e7ffb573227088cef9ceaf80be8c"><td align="right" class="memItemLeft" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/df3/group__imgproc__motion.html#gacb75e7ffb573227088cef9ceaf80be8c">cv::accumulateSquare</a> (<a class="el" href="../../dc/d84/group__core__basic.html#ga353a9de602fe76c709e12074a6f362ba">InputArray</a> src, <a class="el" href="../../dc/d84/group__core__basic.html#gaf77c9a14ef956c50c1efd4547f444e63">InputOutputArray</a> dst, <a class="el" href="../../dc/d84/group__core__basic.html#ga353a9de602fe76c709e12074a6f362ba">InputArray</a> mask=<a class="el" href="../../dc/d84/group__core__basic.html#gad9287b23bba2fed753b36ef561ae7346">noArray</a>())</td></tr>
<tr class="memdesc:gacb75e7ffb573227088cef9ceaf80be8c"><td class="mdescLeft"> </td><td class="mdescRight">Adds the square of a source image to the accumulator image.  <a href="../../d7/df3/group__imgproc__motion.html#gacb75e7ffb573227088cef9ceaf80be8c">More...</a><br/></td></tr>
<tr class="separator:gacb75e7ffb573227088cef9ceaf80be8c"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga4f9552b541187f61f6818e8d2d826bc7"><td align="right" class="memItemLeft" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/df3/group__imgproc__motion.html#ga4f9552b541187f61f6818e8d2d826bc7">cv::accumulateWeighted</a> (<a class="el" href="../../dc/d84/group__core__basic.html#ga353a9de602fe76c709e12074a6f362ba">InputArray</a> src, <a class="el" href="../../dc/d84/group__core__basic.html#gaf77c9a14ef956c50c1efd4547f444e63">InputOutputArray</a> dst, double alpha, <a class="el" href="../../dc/d84/group__core__basic.html#ga353a9de602fe76c709e12074a6f362ba">InputArray</a> mask=<a class="el" href="../../dc/d84/group__core__basic.html#gad9287b23bba2fed753b36ef561ae7346">noArray</a>())</td></tr>
<tr class="memdesc:ga4f9552b541187f61f6818e8d2d826bc7"><td class="mdescLeft"> </td><td class="mdescRight">Updates a running average.  <a href="../../d7/df3/group__imgproc__motion.html#ga4f9552b541187f61f6818e8d2d826bc7">More...</a><br/></td></tr>
<tr class="separator:ga4f9552b541187f61f6818e8d2d826bc7"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga80e5c3de52f6bab3a7c1e60e89308e1b"><td align="right" class="memItemLeft" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/df3/group__imgproc__motion.html#ga80e5c3de52f6bab3a7c1e60e89308e1b">cv::createHanningWindow</a> (<a class="el" href="../../dc/d84/group__core__basic.html#gaad17fda1d0f0d1ee069aebb1df2913c0">OutputArray</a> dst, <a class="el" href="../../dc/d84/group__core__basic.html#ga346f563897249351a34549137c8532a0">Size</a> winSize, int type)</td></tr>
<tr class="memdesc:ga80e5c3de52f6bab3a7c1e60e89308e1b"><td class="mdescLeft"> </td><td class="mdescRight">This function computes a Hanning window coefficients in two dimensions.  <a href="../../d7/df3/group__imgproc__motion.html#ga80e5c3de52f6bab3a7c1e60e89308e1b">More...</a><br/></td></tr>
<tr class="separator:ga80e5c3de52f6bab3a7c1e60e89308e1b"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga552420a2ace9ef3fb053cd630fdb4952"><td align="right" class="memItemLeft" valign="top"><a class="el" href="../../dc/d84/group__core__basic.html#ga32986d8c6fd05949688352abd112509f">Point2d</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/df3/group__imgproc__motion.html#ga552420a2ace9ef3fb053cd630fdb4952">cv::phaseCorrelate</a> (<a class="el" href="../../dc/d84/group__core__basic.html#ga353a9de602fe76c709e12074a6f362ba">InputArray</a> src1, <a class="el" href="../../dc/d84/group__core__basic.html#ga353a9de602fe76c709e12074a6f362ba">InputArray</a> src2, <a class="el" href="../../dc/d84/group__core__basic.html#ga353a9de602fe76c709e12074a6f362ba">InputArray</a> window=<a class="el" href="../../dc/d84/group__core__basic.html#gad9287b23bba2fed753b36ef561ae7346">noArray</a>(), double *response=0)</td></tr>
<tr class="memdesc:ga552420a2ace9ef3fb053cd630fdb4952"><td class="mdescLeft"> </td><td class="mdescRight">The function is used to detect translational shifts that occur between two images.  <a href="../../d7/df3/group__imgproc__motion.html#ga552420a2ace9ef3fb053cd630fdb4952">More...</a><br/></td></tr>
<tr class="separator:ga552420a2ace9ef3fb053cd630fdb4952"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a id="details" name="details"></a><h2 class="groupheader">Detailed Description</h2>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga1a567a79901513811ff3b9976923b199"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga1a567a79901513811ff3b9976923b199">◆ </a></span>accumulate()</h2>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void cv::accumulate </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="../../dc/d84/group__core__basic.html#ga353a9de602fe76c709e12074a6f362ba">InputArray</a> </td>
          <td class="paramname"><em>src</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="../../dc/d84/group__core__basic.html#gaf77c9a14ef956c50c1efd4547f444e63">InputOutputArray</a> </td>
          <td class="paramname"><em>dst</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="../../dc/d84/group__core__basic.html#ga353a9de602fe76c709e12074a6f362ba">InputArray</a> </td>
          <td class="paramname"><em>mask</em> = <code><a class="el" href="../../dc/d84/group__core__basic.html#gad9287b23bba2fed753b36ef561ae7346">noArray</a>()</code> </td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table><table class="python_language"><tr><th colspan="999" style="text-align:left">Python:</th></tr><tr><td style="width: 20px;"></td><td>dst</td><td>=</td><td>cv.accumulate(</td><td class="paramname">src, dst[, mask]</td><td>)</td></tr></table>
</div><div class="memdoc">
<p><code>#include &lt;<a class="el" href="../../d1/d4f/imgproc_2include_2opencv2_2imgproc_8hpp.html">opencv2/imgproc.hpp</a>&gt;</code></p>
<p>Adds an image to the accumulator image. </p>
<p>The function adds src or some of its elements to dst :</p>
<p class="formulaDsp">
\[\texttt{dst} (x,y) \leftarrow \texttt{dst} (x,y) + \texttt{src} (x,y) \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\]
</p>
<p>The function supports multi-channel images. Each channel is processed independently.</p>
<p>The function <a class="el" href="../../d7/df3/group__imgproc__motion.html#ga1a567a79901513811ff3b9976923b199" title="Adds an image to the accumulator image. ">cv::accumulate</a> can be used, for example, to collect statistics of a scene background viewed by a still camera and for the further foreground-background segmentation.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">src</td><td>Input image of type <a class="el" href="../../d1/d1b/group__core__hal__interface.html#ga78c5506f62d99edd7e83aba259250394">CV_8UC(n)</a>, <a class="el" href="../../d1/d1b/group__core__hal__interface.html#ga76d22d2e9b90571328923e17f0f8af2a">CV_16UC(n)</a>, <a class="el" href="../../d1/d1b/group__core__hal__interface.html#ga56e67b727727f2f9b73a4b62f0c4b2b5">CV_32FC(n)</a> or <a class="el" href="../../d1/d1b/group__core__hal__interface.html#ga4213eb262159eb6da4edf8c9255e8244">CV_64FC(n)</a>, where n is a positive integer. </td></tr>
    <tr><td class="paramname">dst</td><td>Accumulator image with the same number of channels as input image, and a depth of CV_32F or CV_64F. </td></tr>
    <tr><td class="paramname">mask</td><td>Optional operation mask.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="../../d7/df3/group__imgproc__motion.html#gacb75e7ffb573227088cef9ceaf80be8c" title="Adds the square of a source image to the accumulator image. ">accumulateSquare</a>, <a class="el" href="../../d7/df3/group__imgproc__motion.html#ga82518a940ecfda49460f66117ac82520" title="Adds the per-element product of two input images to the accumulator image. ">accumulateProduct</a>, <a class="el" href="../../d7/df3/group__imgproc__motion.html#ga4f9552b541187f61f6818e8d2d826bc7" title="Updates a running average. ">accumulateWeighted</a> </dd></dl>
</div>
</div>
<a id="ga82518a940ecfda49460f66117ac82520"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga82518a940ecfda49460f66117ac82520">◆ </a></span>accumulateProduct()</h2>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void cv::accumulateProduct </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="../../dc/d84/group__core__basic.html#ga353a9de602fe76c709e12074a6f362ba">InputArray</a> </td>
          <td class="paramname"><em>src1</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="../../dc/d84/group__core__basic.html#ga353a9de602fe76c709e12074a6f362ba">InputArray</a> </td>
          <td class="paramname"><em>src2</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="../../dc/d84/group__core__basic.html#gaf77c9a14ef956c50c1efd4547f444e63">InputOutputArray</a> </td>
          <td class="paramname"><em>dst</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="../../dc/d84/group__core__basic.html#ga353a9de602fe76c709e12074a6f362ba">InputArray</a> </td>
          <td class="paramname"><em>mask</em> = <code><a class="el" href="../../dc/d84/group__core__basic.html#gad9287b23bba2fed753b36ef561ae7346">noArray</a>()</code> </td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table><table class="python_language"><tr><th colspan="999" style="text-align:left">Python:</th></tr><tr><td style="width: 20px;"></td><td>dst</td><td>=</td><td>cv.accumulateProduct(</td><td class="paramname">src1, src2, dst[, mask]</td><td>)</td></tr></table>
</div><div class="memdoc">
<p><code>#include &lt;<a class="el" href="../../d1/d4f/imgproc_2include_2opencv2_2imgproc_8hpp.html">opencv2/imgproc.hpp</a>&gt;</code></p>
<p>Adds the per-element product of two input images to the accumulator image. </p>
<p>The function adds the product of two images or their selected regions to the accumulator dst :</p>
<p class="formulaDsp">
\[\texttt{dst} (x,y) \leftarrow \texttt{dst} (x,y) + \texttt{src1} (x,y) \cdot \texttt{src2} (x,y) \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\]
</p>
<p>The function supports multi-channel images. Each channel is processed independently.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">src1</td><td>First input image, 1- or 3-channel, 8-bit or 32-bit floating point. </td></tr>
    <tr><td class="paramname">src2</td><td>Second input image of the same type and the same size as src1 . </td></tr>
    <tr><td class="paramname">dst</td><td>Accumulator image with the same number of channels as input images, 32-bit or 64-bit floating-point. </td></tr>
    <tr><td class="paramname">mask</td><td>Optional operation mask.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="../../d7/df3/group__imgproc__motion.html#ga1a567a79901513811ff3b9976923b199" title="Adds an image to the accumulator image. ">accumulate</a>, <a class="el" href="../../d7/df3/group__imgproc__motion.html#gacb75e7ffb573227088cef9ceaf80be8c" title="Adds the square of a source image to the accumulator image. ">accumulateSquare</a>, <a class="el" href="../../d7/df3/group__imgproc__motion.html#ga4f9552b541187f61f6818e8d2d826bc7" title="Updates a running average. ">accumulateWeighted</a> </dd></dl>
</div>
</div>
<a id="gacb75e7ffb573227088cef9ceaf80be8c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gacb75e7ffb573227088cef9ceaf80be8c">◆ </a></span>accumulateSquare()</h2>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void cv::accumulateSquare </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="../../dc/d84/group__core__basic.html#ga353a9de602fe76c709e12074a6f362ba">InputArray</a> </td>
          <td class="paramname"><em>src</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="../../dc/d84/group__core__basic.html#gaf77c9a14ef956c50c1efd4547f444e63">InputOutputArray</a> </td>
          <td class="paramname"><em>dst</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="../../dc/d84/group__core__basic.html#ga353a9de602fe76c709e12074a6f362ba">InputArray</a> </td>
          <td class="paramname"><em>mask</em> = <code><a class="el" href="../../dc/d84/group__core__basic.html#gad9287b23bba2fed753b36ef561ae7346">noArray</a>()</code> </td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table><table class="python_language"><tr><th colspan="999" style="text-align:left">Python:</th></tr><tr><td style="width: 20px;"></td><td>dst</td><td>=</td><td>cv.accumulateSquare(</td><td class="paramname">src, dst[, mask]</td><td>)</td></tr></table>
</div><div class="memdoc">
<p><code>#include &lt;<a class="el" href="../../d1/d4f/imgproc_2include_2opencv2_2imgproc_8hpp.html">opencv2/imgproc.hpp</a>&gt;</code></p>
<p>Adds the square of a source image to the accumulator image. </p>
<p>The function adds the input image src or its selected region, raised to a power of 2, to the accumulator dst :</p>
<p class="formulaDsp">
\[\texttt{dst} (x,y) \leftarrow \texttt{dst} (x,y) + \texttt{src} (x,y)^2 \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\]
</p>
<p>The function supports multi-channel images. Each channel is processed independently.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">src</td><td>Input image as 1- or 3-channel, 8-bit or 32-bit floating point. </td></tr>
    <tr><td class="paramname">dst</td><td>Accumulator image with the same number of channels as input image, 32-bit or 64-bit floating-point. </td></tr>
    <tr><td class="paramname">mask</td><td>Optional operation mask.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="../../d7/df3/group__imgproc__motion.html#gacb75e7ffb573227088cef9ceaf80be8c" title="Adds the square of a source image to the accumulator image. ">accumulateSquare</a>, <a class="el" href="../../d7/df3/group__imgproc__motion.html#ga82518a940ecfda49460f66117ac82520" title="Adds the per-element product of two input images to the accumulator image. ">accumulateProduct</a>, <a class="el" href="../../d7/df3/group__imgproc__motion.html#ga4f9552b541187f61f6818e8d2d826bc7" title="Updates a running average. ">accumulateWeighted</a> </dd></dl>
</div>
</div>
<a id="ga4f9552b541187f61f6818e8d2d826bc7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga4f9552b541187f61f6818e8d2d826bc7">◆ </a></span>accumulateWeighted()</h2>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void cv::accumulateWeighted </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="../../dc/d84/group__core__basic.html#ga353a9de602fe76c709e12074a6f362ba">InputArray</a> </td>
          <td class="paramname"><em>src</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="../../dc/d84/group__core__basic.html#gaf77c9a14ef956c50c1efd4547f444e63">InputOutputArray</a> </td>
          <td class="paramname"><em>dst</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double </td>
          <td class="paramname"><em>alpha</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="../../dc/d84/group__core__basic.html#ga353a9de602fe76c709e12074a6f362ba">InputArray</a> </td>
          <td class="paramname"><em>mask</em> = <code><a class="el" href="../../dc/d84/group__core__basic.html#gad9287b23bba2fed753b36ef561ae7346">noArray</a>()</code> </td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table><table class="python_language"><tr><th colspan="999" style="text-align:left">Python:</th></tr><tr><td style="width: 20px;"></td><td>dst</td><td>=</td><td>cv.accumulateWeighted(</td><td class="paramname">src, dst, alpha[, mask]</td><td>)</td></tr></table>
</div><div class="memdoc">
<p><code>#include &lt;<a class="el" href="../../d1/d4f/imgproc_2include_2opencv2_2imgproc_8hpp.html">opencv2/imgproc.hpp</a>&gt;</code></p>
<p>Updates a running average. </p>
<p>The function calculates the weighted sum of the input image src and the accumulator dst so that dst becomes a running average of a frame sequence:</p>
<p class="formulaDsp">
\[\texttt{dst} (x,y) \leftarrow (1- \texttt{alpha} ) \cdot \texttt{dst} (x,y) + \texttt{alpha} \cdot \texttt{src} (x,y) \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\]
</p>
<p>That is, alpha regulates the update speed (how fast the accumulator "forgets" about earlier images). The function supports multi-channel images. Each channel is processed independently.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">src</td><td>Input image as 1- or 3-channel, 8-bit or 32-bit floating point. </td></tr>
    <tr><td class="paramname">dst</td><td>Accumulator image with the same number of channels as input image, 32-bit or 64-bit floating-point. </td></tr>
    <tr><td class="paramname">alpha</td><td>Weight of the input image. </td></tr>
    <tr><td class="paramname">mask</td><td>Optional operation mask.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="../../d7/df3/group__imgproc__motion.html#ga1a567a79901513811ff3b9976923b199" title="Adds an image to the accumulator image. ">accumulate</a>, <a class="el" href="../../d7/df3/group__imgproc__motion.html#gacb75e7ffb573227088cef9ceaf80be8c" title="Adds the square of a source image to the accumulator image. ">accumulateSquare</a>, <a class="el" href="../../d7/df3/group__imgproc__motion.html#ga82518a940ecfda49460f66117ac82520" title="Adds the per-element product of two input images to the accumulator image. ">accumulateProduct</a> </dd></dl>
</div>
</div>
<a id="ga80e5c3de52f6bab3a7c1e60e89308e1b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga80e5c3de52f6bab3a7c1e60e89308e1b">◆ </a></span>createHanningWindow()</h2>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void cv::createHanningWindow </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="../../dc/d84/group__core__basic.html#gaad17fda1d0f0d1ee069aebb1df2913c0">OutputArray</a> </td>
          <td class="paramname"><em>dst</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="../../dc/d84/group__core__basic.html#ga346f563897249351a34549137c8532a0">Size</a> </td>
          <td class="paramname"><em>winSize</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int </td>
          <td class="paramname"><em>type</em> </td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table><table class="python_language"><tr><th colspan="999" style="text-align:left">Python:</th></tr><tr><td style="width: 20px;"></td><td>dst</td><td>=</td><td>cv.createHanningWindow(</td><td class="paramname">winSize, type[, dst]</td><td>)</td></tr></table>
</div><div class="memdoc">
<p><code>#include &lt;<a class="el" href="../../d1/d4f/imgproc_2include_2opencv2_2imgproc_8hpp.html">opencv2/imgproc.hpp</a>&gt;</code></p>
<p>This function computes a Hanning window coefficients in two dimensions. </p>
<p>See (<a href="http://en.wikipedia.org/wiki/Hann_function">http://en.wikipedia.org/wiki/Hann_function</a>) and (<a href="http://en.wikipedia.org/wiki/Window_function">http://en.wikipedia.org/wiki/Window_function</a>) for more information.</p>
<p>An example is shown below: </p><div class="fragment"><div class="line"><span class="comment">// create hanning window of size 100x100 and type CV_32F</span></div><div class="line">Mat hann;</div><div class="line"><a class="code" href="../../d7/df3/group__imgproc__motion.html#ga80e5c3de52f6bab3a7c1e60e89308e1b">createHanningWindow</a>(hann, <a class="code" href="../../dc/d84/group__core__basic.html#ga346f563897249351a34549137c8532a0">Size</a>(100, 100), <a class="code" href="../../d1/d1b/group__core__hal__interface.html#ga4a3def5d72b74bed31f5f8ab7676099c">CV_32F</a>);</div></div><!-- fragment --> <dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">dst</td><td>Destination array to place Hann coefficients in </td></tr>
    <tr><td class="paramname">winSize</td><td>The window size specifications (both width and height must be &gt; 1) </td></tr>
    <tr><td class="paramname">type</td><td>Created array type </td></tr>
  </table>
  </dd>
</dl>
</div>
</div>
<a id="ga552420a2ace9ef3fb053cd630fdb4952"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga552420a2ace9ef3fb053cd630fdb4952">◆ </a></span>phaseCorrelate()</h2>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="../../dc/d84/group__core__basic.html#ga32986d8c6fd05949688352abd112509f">Point2d</a> cv::phaseCorrelate </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="../../dc/d84/group__core__basic.html#ga353a9de602fe76c709e12074a6f362ba">InputArray</a> </td>
          <td class="paramname"><em>src1</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="../../dc/d84/group__core__basic.html#ga353a9de602fe76c709e12074a6f362ba">InputArray</a> </td>
          <td class="paramname"><em>src2</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="../../dc/d84/group__core__basic.html#ga353a9de602fe76c709e12074a6f362ba">InputArray</a> </td>
          <td class="paramname"><em>window</em> = <code><a class="el" href="../../dc/d84/group__core__basic.html#gad9287b23bba2fed753b36ef561ae7346">noArray</a>()</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double * </td>
          <td class="paramname"><em>response</em> = <code>0</code> </td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table><table class="python_language"><tr><th colspan="999" style="text-align:left">Python:</th></tr><tr><td style="width: 20px;"></td><td>retval, response</td><td>=</td><td>cv.phaseCorrelate(</td><td class="paramname">src1, src2[, window]</td><td>)</td></tr></table>
</div><div class="memdoc">
<p><code>#include &lt;<a class="el" href="../../d1/d4f/imgproc_2include_2opencv2_2imgproc_8hpp.html">opencv2/imgproc.hpp</a>&gt;</code></p>
<p>The function is used to detect translational shifts that occur between two images. </p>
<p>The operation takes advantage of the Fourier shift theorem for detecting the translational shift in the frequency domain. It can be used for fast image registration as well as motion estimation. For more information please see <a href="http://en.wikipedia.org/wiki/Phase_correlation">http://en.wikipedia.org/wiki/Phase_correlation</a></p>
<p>Calculates the cross-power spectrum of two supplied source arrays. The arrays are padded if needed with getOptimalDFTSize.</p>
<p>The function performs the following equations:</p><ul>
<li>First it applies a Hanning window (see <a href="http://en.wikipedia.org/wiki/Hann_function">http://en.wikipedia.org/wiki/Hann_function</a>) to each image to remove possible edge effects. This window is cached until the array size changes to speed up processing time.</li>
<li>Next it computes the forward DFTs of each source array: <p class="formulaDsp">
\[\mathbf{G}_a = \mathcal{F}\{src_1\}, \; \mathbf{G}_b = \mathcal{F}\{src_2\}\]
</p>
 where \(\mathcal{F}\) is the forward DFT.</li>
<li>It then computes the cross-power spectrum of each frequency domain array: <p class="formulaDsp">
\[R = \frac{ \mathbf{G}_a \mathbf{G}_b^*}{|\mathbf{G}_a \mathbf{G}_b^*|}\]
</p>
</li>
<li>Next the cross-correlation is converted back into the time domain via the inverse DFT: <p class="formulaDsp">
\[r = \mathcal{F}^{-1}\{R\}\]
</p>
</li>
<li>Finally, it computes the peak location and computes a 5x5 weighted centroid around the peak to achieve sub-pixel accuracy. <p class="formulaDsp">
\[(\Delta x, \Delta y) = \texttt{weightedCentroid} \{\arg \max_{(x, y)}\{r\}\}\]
</p>
</li>
<li>If non-zero, the response parameter is computed as the sum of the elements of r within the 5x5 centroid around the peak location. It is normalized to a maximum of 1 (meaning there is a single peak) and will be smaller when there are multiple peaks.</li>
</ul>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">src1</td><td>Source floating point array (CV_32FC1 or CV_64FC1) </td></tr>
    <tr><td class="paramname">src2</td><td>Source floating point array (CV_32FC1 or CV_64FC1) </td></tr>
    <tr><td class="paramname">window</td><td>Floating point array with windowing coefficients to reduce edge effects (optional). </td></tr>
    <tr><td class="paramname">response</td><td>Signal power within the 5x5 centroid around the peak, between 0 and 1 (optional). </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>detected phase shift (sub-pixel) between the two arrays.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="../../d2/de8/group__core__array.html#gadd6cf9baf2b8b704a11b5f04aaf4f39d" title="Performs a forward or inverse Discrete Fourier transform of a 1D or 2D floating-point array...">dft</a>, <a class="el" href="../../d2/de8/group__core__array.html#ga6577a2e59968936ae02eb2edde5de299" title="Returns the optimal DFT size for a given vector size. ">getOptimalDFTSize</a>, <a class="el" href="../../d2/de8/group__core__array.html#gaa708aa2d2e57a508f968eb0f69aa5ff1" title="Calculates the inverse Discrete Fourier Transform of a 1D or 2D array. ">idft</a>, <a class="el" href="../../d2/de8/group__core__array.html#ga3ab38646463c59bf0ce962a9d51db64f" title="Performs the per-element multiplication of two Fourier spectrums. ">mulSpectrums</a> <a class="el" href="../../d7/df3/group__imgproc__motion.html#ga80e5c3de52f6bab3a7c1e60e89308e1b" title="This function computes a Hanning window coefficients in two dimensions. ">createHanningWindow</a> </dd></dl>
</div>
</div>
</div><!-- contents -->
<!-- HTML footer for doxygen 1.8.6-->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri Apr 2 2021 11:36:40 for OpenCV by  <a href="http://www.doxygen.org/index.html">
<img alt="doxygen" class="footer" src="../../doxygen.png"/>
</a> 1.8.13
</small></address>
<script type="text/javascript">
//<![CDATA[
addTutorialsButtons();
//]]>
</script>
</body>
</html>
